package cn.demo.pm.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.core.constant.SqlOperator;
import com.mybatisflex.core.query.SqlOperators;
import cn.demo.common.mybatisFlex.MyInsertListener;
import cn.demo.common.mybatisFlex.MyUpdateListener;
import cn.demo.common.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cn.demo.common.core.domain.BaseEntity;
/**
 * 积分商城订单对象 pm_store_order
 *
 * @author xtjun
 * @date 2024-06-28
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(value = "pm_store_order",onInsert = MyInsertListener.class,onUpdate = MyUpdateListener.class)
public class PmStoreOrder extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "id")
    private String id;

    @Excel(name = "用户id")
    @Schema(description = "用户id")
    private String userId;

    @Excel(name = "商品id")
    @Schema(description = "商品id")
    private String goodsId;

    @Excel(name = "商品名称")
    @Schema(description = "商品名称")
    private String goodsName;

    @Excel(name = "商品图片")
    @Schema(description = "商品图片")
    private String goodsPic;

    @Excel(name = "商品数量")
    @Schema(description = "商品数量")
    private Integer goodsNum;

    @Excel(name = "积分")
    @Schema(description = "积分")
    private Long integral;

    @Excel(name = "兑换码")
    @Schema(description = "兑换码")
    private String redemptionCode;

    @Excel(name = "手机号")
    @Schema(description = "手机号")
    private String phone;

    @Excel(name = "配送地区")
    @Schema(description = "配送地区")
    private String expressArea;

    @Excel(name = "配送地址")
    @Schema(description = "配送地址")
    private String expressAddr;

    @Excel(name = "快递公司")
    @Schema(description = "快递公司")
    private String expressName;

    @Excel(name = "快递单号")
    @Schema(description = "快递单号")
    private String expressCode;

    @Excel(name = "是否支付", dictType = "sys_yes_no")
    @Schema(description = "是否支付(字典:sys_yes_no)")
    private Integer isPay;

    @Excel(name = "订单状态", dictType = "pm_order_status")
    @Schema(description = "订单状态(字典:pm_order_status)")
    private Integer orderStatus;

    @Excel(name = "部门id")
    @Schema(description = "部门id")
    private String deptId;

    // 自定义字段的 SQL 操作符
    @JsonIgnore
    public static final SqlOperators operators = new SqlOperators() {{
        set(PmStoreOrder::getUserId, SqlOperator.EQUALS);
        set(PmStoreOrder::getGoodsId, SqlOperator.EQUALS);
        set(PmStoreOrder::getGoodsName, SqlOperator.LIKE);
        set(PmStoreOrder::getGoodsNum, SqlOperator.EQUALS);
        set(PmStoreOrder::getIntegral, SqlOperator.EQUALS);
        set(PmStoreOrder::getRedemptionCode, SqlOperator.EQUALS);
        set(PmStoreOrder::getPhone, SqlOperator.LIKE);
        set(PmStoreOrder::getExpressArea, SqlOperator.EQUALS);
        set(PmStoreOrder::getExpressAddr, SqlOperator.LIKE);
        set(PmStoreOrder::getExpressName, SqlOperator.LIKE);
        set(PmStoreOrder::getExpressCode, SqlOperator.EQUALS);
        set(PmStoreOrder::getIsPay, SqlOperator.EQUALS);
        set(PmStoreOrder::getOrderStatus, SqlOperator.EQUALS);
        set(PmStoreOrder::getDeptId, SqlOperator.EQUALS);
    }};
}
